﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System.Collections.Generic;
using System.Data;
using ScrumTable.Common.Collections;
using ScrumTable.DL.Data.Generic.Cache;

#endregion

namespace ScrumTable.DL.Data.Excel
{
    /// <summary>
    /// Contains information about an indexed work item entry.
    /// </summary>
    internal class WorkItemMultiIndexEntry : IMultiIndexValue
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        internal string BackEndId { get; set; }
        internal int Id { get; set; }
        internal DataRow Data { get; set; }
        internal CacheWorkItemType Type { get; set; }
        internal CacheWorkItem WorkItem { get; set; }
        internal IList<CacheWorkItemLink> ParentLinks { get; private set; }
        internal IList<CacheWorkItemLink> ChildLinks { get; private set; }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        internal WorkItemMultiIndexEntry()
        {
            ParentLinks = new List<CacheWorkItemLink>();
            ChildLinks = new List<CacheWorkItemLink>();
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Returns a list of index name to index value pairs.
        /// </summary>
        public IEnumerable<Pair<string, object>> IndexFieldValues
        {
            get
            {
                return new[]
                           {
                               new Pair<string, object>(WorkItemMultiIndex.BackEndId, BackEndId),
                               new Pair<string, object>(WorkItemMultiIndex.IdField, Id)
                           };
            }
        }

        #endregion
    }
}